<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">  
    <title>订单详情</title>
    <link rel="stylesheet" href="/Public/Home/css/memberOrder.css">
    <script>
        var rnumber = Math.floor(Math.random()*1000);
        history.replaceState({mod: rnumber}, 'Title', '?mod='+rnumber);
    </script>
    <!--不识别数字为手机-->
<meta name="format-detection" content="telephone=no, email=no"/>
<!--通用js-->
<?php if(isset($signPackage) && !empty($signPackage)){ ?>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js?v=201704270010"></script>
<?php } ?>
<script type="text/javascript" src="/Public/Home/js/require.js"></script>
<script type="text/javascript" src="/Public/Home/js/baseLoading.js?v=201705240001"></script>
<script src="/Public/Home/js/jquery.min.js" ></script>
<script src="/Public/Home/js/pincode-input.js" ></script>
<script src="/Public/Home/js/parabola.js" ></script>
<script src="/Public/Home/js/lazyload/jquery.lazyload.min.js"></script>
<script type="text/javascript">
    _global.isLogin = !!"<?php echo $wx_member_id; ?>";
	var isWxShareDiy = typeof yc_share_diy === "undefined" ? false : yc_share_diy;
	var yc_wx_shareImgPath = "";
	<?php if(isset($weixin_logo) && !empty($weixin_logo)){ ?>
		yc_wx_shareImgPath = "/Uploads/<?php echo ($weixin_logo["image"]); ?>";
	<?php } ?>
    var yc_pass_arr = {'local_id':"<?php echo I('local_id',1);?>",'top_local_id':"<?php echo I('top_local_id',1);?>"};
	if(parseInt(yc_pass_arr["local_id"]) == 21){
		_global.isStopSell = true;
	}
    <?php if(isset($signPackage) && !empty($signPackage)){ ?>
        _global.isWeiXinLoad = true;
        var isEnableLocation = typeof yc_wx_location === "undefined" ? false : yc_wx_location;
        var yc_wx_options = {
            "enableLocation" : isEnableLocation,
            "refuseCallback" : function(){},
            "mapCallback" : function(){},
            "config" : {
                debug: false,
                appId: '<?php echo $signPackage["appId"];?>',
                timestamp: '<?php echo $signPackage["timestamp"];?>',
                nonceStr: '<?php echo $signPackage["nonceStr"];?>',
                signature: '<?php echo $signPackage["signature"];?>',
                jsApiList: [
                    'checkJsApi'
                ]
            }
        };
        var isInHeader = typeof yc_wx_useInHeader === "undefined" ? true : yc_wx_useInHeader;
        if(isInHeader){
            wxAutoConfig(yc_wx_options);
        }
    <?php } ?>
</script>
</head>
<body>
	<div class="warp">
        <div id="ycOrderIdTip" class="order-id-tip" style="display:none;">
            对不起！您上传的身份信息有误未通过审核，为保证您能顺利收到商品，请重新上传！
            <a id="ycIdUploadBtn" href="javascript:;" class="go-up">去上传&gt;</a>
        </div>
        <!--订单类别-->
		<div class="member-order-top mgTop">
			<!-- 查看更多物流信息 -->
            <?php $kuaidiurl = get_url() ?>
			<div class="member-logistics-more">
                <?php if($vt[logi_name] != '怡臣速送'): ?><a href="javascript:0" onclick="kuaidi(this)" data-url="https://m.kuaidi100.com/index_all.html?type=<?php echo ($order_data['logi_name']); ?>&postid=<?php echo ($order_data['logi_no']); ?>&callbackurl=<?php echo ($kuaidiurl[top]); echo ($kuaidiurl[host]); ?>/member/memberOredrData/order_id/<?php echo ($orderId); ?>" data-id="<?php echo ($order_data['logi_no']); ?>">
                        <i><img src="/Public/Home/images/logistics-icon_a.png" alt=""></i>
                        <h3>点击查看更多物流信息</h3>
                    </a>
                <?php else: ?>
                    <a href="<?php echo url('Member/delivery',['order_id' => $vo[order_id]]);?>">
                        <i><img src="/Public/Home/images/logistics-icon_a.png" alt=""></i>
                        <h3>点击查看更多物流信息</h3>
                    </a><?php endif; ?>
			</div>
			<div class="member-location-more">
				<a href="">
					<i><img src="/Public/Home/images/logistics-icon_b.png" alt=""></i>
					<h3>收货人：<span><?php echo ($order_data[ship_name]); ?></span><span class="location-iphone"><?php echo ($addr_data[ship_mobile]); ?></span></h3>
					<h3>收货地址:<?php echo ($order_data[ship_addr]); ?></h3>
				</a>
			</div>
		</div>		
		<!-- 订单列表 -->
		<div class="member-order-list mgTop">
			<!--已发货-->
			<div class="member-order-listber">
				<!--商铺名称-->
				<div class="member-order-header">
					<div class="shop-choice">
						<i><img src="/Public/Home/images/member-shop-icon.png"></i>
						<span><?php echo ($order_data[local_name]); ?></span>
					</div>
				</div>
				<!--订单详情-->
				<div class="member-order-contant">
					<!--商品描述-->
                    <?php $price = ''; $g_price = ''; $sfyz_type = 0; ?>
					<div class="single-item dataItem">
                        <?php if(is_array($data)): foreach($data as $k=>$vo): ?><div class="swipe-item">
                                <a href="" class="img"><img src="/Uploads/<?php echo ($vo[s_url]); ?>" alt=""></a>
                                <div class="goods-text">
                                    <a href="" class="name"><?php echo ($vo[name]); ?></a>
                                    <p class="pninfo"><span class="price">¥<?php echo ($vo[price]); ?></span><span class="num">&nbsp;X&nbsp;<?php echo ($vo[nums]); ?></span></p>
                                </div>
                                <!-- 退款成功 -->
                                <?php switch($vo['t_status']){ case '-1' : case '0' : echo ""; break; case '1' : case '2' : case '3' : case '6' : case '4' : echo "<div class='refund-tips red' >退款中</div>"; break; case '5' : echo "<div class='refund-tips red'>退款成功</div>"; break; } ?>
                                <!-- 退款中 -->
                            </div>
                            <?php $price += $vo['price']; $g_price += $vo['g_price']; $tmp = intval($vo['identity_card_status']); if($tmp > $sfyz_type){ $sfyz_type = $tmp; } endforeach; endif; ?>
                    <!--商品数量和价格-->
                    <div class="swipe-price">
						<!--<span class="swipe-price_lei red">组合促销</span>-->
                    	<div class="swipe-price-data">
							<span><?php if($order_data[cost_freight] > 0 ): ?>(含运费<?php echo ($order_data[cost_freight]); ?>元)<?php else: ?> (不含运费)<?php endif; ?> 共计: <em class="red"> <?php echo ($order_data[total_amount]); ?></em></span>
						</div>
					</div>
				</div>
				</div>
			</div>
		</div>
        <?php  ?>
		<!--订单信息module-->
		<div class="order-mes mgTop">
			<!--商铺名称-->
			<div class="member-order-header">
				<div class="shop-choice">
					<span>订单信息</span>
				</div>
			</div>
			<!--订单详情-->

			<div class="order-mes-list">
					<!--代发货-->
					<p><label>订单状态:</label><span class="order-mes-active"><?php echo ($order_data[order_msg]); ?></span></p>
					<!--交易关闭-->
					<p style="display: none"><label>订单状态:</label><span class="order-mes-active">删除订单</span></p>
					<!--待自提-->
					<p style="display: none"><label>订单状态:</label><span class="order-mes-active">待自提</span></p>
					<p><label>订单号码:</label><span><?php echo ($order_data[order_id]); ?></span></p>
					<!--<p><label>订单状态:</label><span>待发货</span></p>-->
					<p><label>下单时间:</label><span><?php echo (date('Y-m-d H:i:s',$order_data[createtime])); ?> </span></p>
					<p><label>支付方式:</label><span><?php echo ($order_data[payment]); ?></span></p>
					<p><label>订单备注:</label><span><?php echo ($order_data[memo]); ?></span></p>
			</div>
			<!--订单结算结果-->
			<div class="order-balance-module mgTop">
				<p>
					<label>商品总金额：</label>
					<span>￥<?php echo ($order_data[cost_item]); ?></span>
				</p>
				<p>
					<label>运费：</label>
					<span>￥<?php echo ($order_data[cost_freight]?$order_data[cost_freight]:'0'); ?></span>
				</p>
				<p>
					<label>优惠金额：</label>
					<span>￥<?php echo (($order_data['cost_item']+$order_data['cost_freight'])-$order_data['total_amount']) ?></span>
				</p>
            <?php if($order_data['bonus_pay'] > 0): ?><p>
                    <label>使用奖金：</label>
                    <span>￥<?php echo (($order_data['bonus_pay'])) ?></span>
                </p>
                <p>
                    <label>微信支付：</label>
                    <span>￥<?php echo ($order_data['total_amount']-$order_data['bonus_pay']) ?></span>
                </p><?php endif; ?>
				<p>
					<label>实付金额：</label>
					<span class="balance-current red">￥<?php echo ($order_data[total_amount]); ?></span>
				</p>
			</div>
			<!--订单详情页操作-->

			<div class="member-order-but">
                <?php if(($order_data[status] == 'finish') and (($order_data[refund_ago_goods_status] == 2) or ($order_data[refund_ago_money_status] == 2) )): ?><!--<a class="refund-but order-but-public current" href="<?php echo url('Member/after_sale_refund',['order_id' => $order_data[order_id]]);?>">退款详情</a>-->
                    <a class="cancel-but order-but-public current" href="<?php echo url('Member/afterSale',['order_id' => $order_data[order_id]]);?>">售后</a>
                    <!--已失效-->
                <?php elseif($order_data[status] == 'dead'): ?>
                        <a class="cancel-but order-but-public current"  href="javascript:void(0)" onclick="ajaxOpreateOrder('<?php echo ($order_data[order_id]); ?>',3)">删除订单</a>

                <?php else: ?>
                    <!--未支付-->
                    <?php if($order_data[pay_status] == '0'): ?><a class="refund-but order-but-public current" href="javascript:0" onclick="ajaxOpreateOrder('<?php echo ($order_data[order_id]); ?>',1)">取消订单</a>
                        <a class="reminder-but order-but-public current"  href="<?php echo url('Member/payOrder',['order_id' => $order_data[order_id]]);?>">去付款</a><?php endif; ?>
                    <!--未发货-->
                    <?php if(($order_data[pay_status] == '1') and ($order_data[ship_status] == '0')): if((($order_data[refund_ago_goods_status] == 2) or ($order_data[refund_ago_money_status] == 2) )): ?><!--<a class="refund-but order-but-public current" href="<?php echo url('Member/after_sale_refund',['order_id' => $order_data[order_id]]);?>">退款详情</a>-->
                            <a class="refund-but order-but-public current" href="<?php echo url('Member/afterSale',['order_id' => $order_data[order_id]]);?>">售后</a>

                        <?php else: ?>
                            <?php if($order_data[status] == 'active'): ?><a class="refund-but order-but-public current "  href="<?php echo url('MemberRefund/index',['order_id' => $order_data[order_id],'sell' => 'refund_front_status']);?>">退款</a>
                                <?php else: ?>
                                <a class="cancel-but order-but-public current"  href="<?php echo url('MemberRefund/index',['order_id' => $order_data[order_id],'sell' => 'refund_front_status']);?>">退款详情</a><?php endif; endif; ?>
                        <?php if($order_data[status] == 'active'): ?><a class="reminder-but order-but-public current"  href="javascript:0" onclick="askOrder()">催单</a><?php endif; endif; ?>
                    <!--已发货 -->
                    <?php if(($order_data[pay_status] == '1') and ($order_data[ship_status] == '1') and ($order_data[comment_status] == '0')): ?><a class="refund-but order-but-public current" href="<?php echo url('Member/afterSale',['order_id' => $order_data[order_id]]);?>">售后</a>
                        <a class="reminder-but order-but-public current "  href="javascript:void(0)" onclick="ajaxOpreateOrder('<?php echo ($order_data[order_id]); ?>',2)">确认收货</a><?php endif; ?>
                    <!--交易完成未评价、退款完成-->
                    <?php if(($order_data[received_status] == '1') and ($order_data[comment_status] == '1')): ?><a class="refund-but order-but-public current" href="<?php echo url('Member/afterSale',['order_id' => $order_data[order_id]]);?>">售后</a>
                        <a class="reminder-but order-but-public current "  href="<?php echo url('Member/memberEvaluation',['order_id' => $order_data[order_id]]);?>">评价</a><?php endif; ?>
                    <!--交易完成（已评价）-->
                    <?php if(($order_data[received_status] == '1') and ($order_data[comment_status] == '2')): ?><a class="cancel-but order-but-public current" href="<?php echo url('Member/afterSale',['order_id' => $order_data[order_id]]);?>">售后</a>
                        <!--<a class="refund-but order-but-public current" href="<?php echo url('Member/afterSale',['order_id' => $order_data[order_id]]);?>">售后</a>
                        <a class="reminder-but order-but-public current "  href="javascript:0">再次购买</a>--><?php endif; endif; ?>

                <!--交易完成(完结)-->
               <!-- <?php if($order_status[0] == 11 ): ?><a class="cancel-but order-but-public current"  href="javascript:0">再次购买</a><?php endif; ?>-->

			</div>
		</div>
    </div>
	<!-- 绑定手机弹窗 -->
	<div class="alert-popup askorder-reminder" style="display: none">
		<p style="display:block;">如果您的订单还没有发货，可以拨打 <span class="tel"><?php echo ($order_data[tel]); ?></span>联络发货人。</p>
		<p><a href="javascript:void(0);" class="cancel">取消</a><a href="tel://<?php echo ($order_data[tel]); ?>" class="confirm">拨打</a></p>
	</div>
	<script>require(['memberOrderData'])</script>
    <script>        
        var _isAjaxProcess = false;
		function askOrder(){
			_global.promote.popup(".askorder-reminder");
		}
        function ajaxOpreateOrder( orderId, stat){
            if(_isAjaxProcess) return;
            var tiShi;
            if(stat == 1){
                tiShi = '是否取消订单？'
            }else if(stat == 2){
                tiShi = '是否确认收货？'
            }else if(stat == 3){
                tiShi = '是否是删除订单？'
            }
            if (confirm(tiShi)) {
                _isAjaxProcess = true;
                _global.promote.loadPopup("正在处理中...");
                $.ajax({
                    type: "POST",
                    url: "<?php echo url('Member/cancelOrder');?>",
                    data: { "order_id": orderId ,"stat": stat },
                    dataType: "json",
                    success: function (rs) {
                        _global.promote.removeLoad();
                        _global.promote.alertPopup(rs.msg);
                        if(rs.stat){
                            setTimeout(function(){
                                window.location.reload();
                            },300);
                        }
                        _isAjaxProcess = false;
                    },
                    error: function () {
                        _global.promote.removeLoad();
                        _global.promote.alertPopup('服务器异常，请稍后重试！');
                        _isAjaxProcess = false;
                    }
                });
            }
        }
       /* function cancelOrder(orderId,stat){
            $.post("<?php echo url('Member/cancelOrder');?>", { "order_id": orderId ,"stat": stat },
                    function(data){
                        alert(data.msg);
                        window.location.reload();
                    }, "json");
        }*/
        function kuaidi(e){
            if(!$(e).data('id')){
                _global.promote.alertPopup('该订单未发货，不能查看物流信息！');
            }else{
                window.location.href=$(e).data('url');
            }
        }
    </script>
    <?php $isNeedId = false; $isValidIDInfo = true; $curIdNum = $memberData['identity_card_num']; $curIdName = $memberData['identity_name']; $curIdPhoto = $memberData['identity_photo']; $curIdStatus = intval($memberData['identity_verifi']); if((empty($curIdPhoto) && $sfyz_type == 2) || $curIdStatus == 2){ $isValidIDInfo = false; $isNeedId = true; } if($isNeedId){ $sfNeedJs = array('validate' => true, 'upload' => true); echo '<script type="text/javascript">'; echo 'var _ycIdData = {"yzType" : '.$sfyz_type.', "idNum" : "'.$curIdNum.'", "idName" : "'.$curIdName.'", "from" : "order"}'; echo '</script>'; ?>
    <link rel="stylesheet" href="/Public/Home/css/uploadIdentitly.css?v=20170306001">
<!-- 上传身份证弹窗 -->
<div class="upload-identity-frame" style="display: none;">
    <p class="identitly-title">
        <span>海淘实名认证</span>
        <a href="javascript:void(0)" class="close"></a>
    </p>
    <div class="upload-identity-content">
        <div class="upload-identity-ret">
            <p class="indetitly-tips">海关要求购买跨境商品需提供实名信息额</p>
            <input type="text" id="yc_sf_name" value="" placeholder="请输入真实姓名" />
            <input type="text" id="yc_sf_id" placeholder="第二代身份证号（将加密处理）"/>
            <div class="identitly-state">
                <p>请上传身份证正反面共两张图片</p>
                <div class="indetitly-cardimg">
                    <!--正面-->
                    <div class="upload-content-box">
                        <div class="upload-file-list frontpicImg"></div>
                        <i class="upload-btn" id="ycSfFrontBtn">
                            <span>正面</span>
                            <input id='ycSfFrontPic' type='hidden' value='' />      
                            <!-- <input id="ycSfFrontBtn" type="file" accept="image/*" name="file" /> -->
                        </i>
                    </div>
                    <!--反面-->
                    <div class="upload-content-box">
                        <div class="upload-file-list backpicImg"></div>
                        <i class="upload-btn" id="ycSfBackBtn">
                            <span>反面</span>
                            <input id='ycSfBackPic' type='hidden' value='' />                     
                            <!-- <input id="ycSfBackBtn" type="file" accept="image/*" name="file" /> -->
                        </i>
                    </div>
                </div>
                <p class="gray">温馨提示：请勿剪裁涂改照片，保证身份信息清晰显示，否则无法通过审核。</p>
            </div>
        </div>
        <div class="indetitly-mes">
            <h3>为什么需要实名认证？</h3>
            <p>根据海关要求，购买跨境商品需要对订购人进行实名认证，错误信息可能导致无法正常清关。</p>
            <p>你的身份证信息将加密保管，怡臣优选保证信息安全，绝不对外泄漏！</p>
            <p>任何身份认证可联系我们400-023-1666（09:00-18:00）</p>
        </div>
    </div>
    <div id="ycSfUpload" class="upload-submit btn btn-primary">确定</div>
</div>
<?php if(sfNeedJs["validate"]){ ?>
<script type="text/javascript" src="/Public/Home/js/validate.js"></script>
<?php } ?>
<script type="text/javascript" src="/Public/Home/js/cart/identitlyCard.js??v=201704270001"></script>
    <?php } ?>
</body>
</html>